﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.ModFlow.Domain.DomainLayer
{
    [Serializable]
    public class BoundaryCollecionBase
    {


        public BoundaryCollecionBase(int nrows, int ncolumns, int nlayers)
        {

            this._nrows = nrows;
            this._ncols = ncolumns;
            this._nlayers = nlayers;

        }







        [field:NonSerialized]
        public event EventHandler<SCColleconChangedEventArgs> SCCollecionChanged;


        public void AskCollectionChanged(SCColleconChangedEventArgs args)
        {
            if (SCCollecionChanged != null)
            {
                SCCollecionChanged(this,args);
                
            }
 
        }


        protected List<bool> _isUsePrecious = new List<bool>();

        public List<bool> IsUsePrecious
        {
            get { return _isUsePrecious; }
            set { _isUsePrecious = value; }
        }




       protected bool _enabled;

        /// <summary>
        /// 是否启用well集合
        /// </summary>
        public bool Enabled
        {
            get { return _enabled; }
            set { _enabled = value; }
        }

        int _nrows;

        public int Nrows
        {
            get { return _nrows; }
            set { _nrows = value; }
        }
        int _ncols;

        public int Ncols
        {
            get { return _ncols; }
            set { _ncols = value; }
        }
        int _nlayers;

        public int Nlayers
        {
            get { return _nlayers; }
            set { _nlayers = value; }
        }
       

        int _nPeriods;

        public int NPeriods
        {
            get { return _nPeriods; }
            set { _nPeriods = value; }
        }


        public void ResetIsUsePrecious(List<bool> usePrecious)
        {



            this._isUsePrecious.Clear();

            this._isUsePrecious.AddRange(usePrecious);


        }


      public  virtual void _stressPeriods_StressPeriodChanged(object sender, StressPeriodChangedEventArgs e)
        {

            


            List<StressPeriod> lst = (List<StressPeriod>)e.Param;

            this._nPeriods = lst.Count;

            this._isUsePrecious.Clear();

            foreach (StressPeriod item in lst)
            {
                this._isUsePrecious.Add(true);

            }

            if (this._isUsePrecious.Count > 0)
            {
                this._isUsePrecious[0] = false;

            }





        }
     

      public virtual void OnGridReset(int nrows, int ncols, int nlayers)
      {
          this._nrows = nrows;

          this._ncols = ncols;

          this._nlayers = nlayers;



      }


    }
}
